/**
 * Copyright (c), 上海沃恩信息科技有限公司.
 * All rights reserved.
 * Licensed under BSD (https://www.pittypat.work/bsd.html).
 */

package pittypat;

import java.beans.PropertyVetoException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.UUID;

import pittypat.configuration.ConfigException;

/**
 * 提供向用户发送通知的相关功能。
 * <p>
 * INotificationService 支持用户通过 "~/notification/count"、"~/notification/list"、"~/notification/read" 查询新通知数目、查询新通知列表以及将通知标记为已读。
 */
public interface INotificationService {
	/**
	 * 加载指定用户的新通知的数目。
	 * 
	 * @param userId
	 *            用户的 Id。
	 * @param progress
	 *            跟踪和汇报异步操作的进度。
	 * @return 目标用户新通知的数目。
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 * @throws PropertyVetoException
	 * @throws SQLException
	 * @throws ConfigException
	 * @throws SecurityException
	 * @throws NoSuchMethodException
	 * @throws InvocationTargetException
	 * @throws UnsupportedEncodingException
	 * @throws ClassNotFoundException
	 * @throws IllegalArgumentException
	 */
	long count(UUID userId, IAsyncProgress progress) throws InstantiationException, IllegalAccessException,
			IllegalArgumentException, ClassNotFoundException, UnsupportedEncodingException, InvocationTargetException,
			NoSuchMethodException, SecurityException, ConfigException, SQLException, PropertyVetoException;

	/**
	 * 加载指定用户的新通知的列表。
	 * 
	 * @param userId
	 *            用户的 Id。
	 * @param progress
	 *            跟踪和汇报异步操作的进度。
	 * @return 目标用户新通知的列表。
	 * @throws PropertyVetoException
	 * @throws SQLException
	 * @throws ConfigException
	 * @throws SecurityException
	 * @throws NoSuchMethodException
	 * @throws InvocationTargetException
	 * @throws UnsupportedEncodingException
	 * @throws ClassNotFoundException
	 * @throws InstantiationException
	 * @throws IllegalAccessException
	 * @throws IllegalArgumentException
	 */
	NotificationList list(UUID userId, IAsyncProgress progress)
			throws IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException,
			UnsupportedEncodingException, InvocationTargetException, NoSuchMethodException, SecurityException,
			ConfigException, SQLException, PropertyVetoException;

	/**
	 * 将指定的通知记录标记为已读。
	 * 
	 * @param userId
	 *            用户的 Id。
	 * @param notificationId
	 *            要标记为已读的通知记录的 Id。
	 * @param progress
	 *            跟踪和汇报异步操作的进度。
	 * @return 通知被标记的时间。
	 * @throws PropertyVetoException
	 * @throws SQLException
	 * @throws ConfigException
	 * @throws SecurityException
	 * @throws NoSuchMethodException
	 * @throws InvocationTargetException
	 * @throws UnsupportedEncodingException
	 * @throws ClassNotFoundException
	 * @throws InstantiationException
	 * @throws IllegalAccessException
	 * @throws IllegalArgumentException
	 */
	LocalDateTime read(UUID userId, UUID notificationId, IAsyncProgress progress)
			throws IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException,
			UnsupportedEncodingException, InvocationTargetException, NoSuchMethodException, SecurityException,
			ConfigException, SQLException, PropertyVetoException;
}
